/**
 * Created with IntelliJ IDEA.
 * Description:
 * user:likai
 * Date:2022-10-11
 * Time:9:53
 */
class Person implements Comparable<Person>{
    int age;

    @Override
    public int compareTo(Person o) {
        return this.age-o.age;
    }
}
class A<T extends Comparable<T>>{
    T[] array=(T[])new Object[10];


    public T[] getArray() {
        return array;
    }

    public void setArray(T[] array) {
        this.array = array;
    }

    public T fun(T[] array){
        T max=array[0];
        for (int i = 0; i < array.length; i++) {
            if(max.compareTo(array[i])<0){
                max=array[i];
            }
        }
        return max;
    }
}
public class Test {
    //不是静态方法，创建对象才能使用
    public static void main(String[] args) {
        Integer [] array={1,2,3,4,5};
        A<Integer> a=new A<>();
        Integer ret=a.fun(array);
    }

}
